def grep(context, config, &block)
  return true  unless config.key?(:key) && config.key?(:regexp)

  if !block.nil?
    pr = block
  else
    regexp = %r{#{config[:regexp]}}
    key = config[:key].to_sym

    if config.key?(:invert) && config[:invert] == true
      pr = Proc.new {|item| item[key] !~ regexp }
    else
      pr = Proc.new {|item| item[key] =~ regexp }
    end
  end

  context.entries = context.entries.select &pr
end

